package Homework;

import java.util.Scanner;

/**
 * @program: Java_Study
 * @author: Xiaofan
 * @createTime: 2021-07-06 21:33
 * @description: Functions of this class is 数据排序
 **/
public class D3 {
    public static void main(String args[]){
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int n=scanner.nextInt();
            int nums[]=new int[n];
            for(int i=0;i<n;i++){
                nums[i]=scanner.nextInt();
            }
            quickSort(nums,0,nums.length-1);
            for(int i:nums){
                System.out.print(i+",");
            }
            System.out.println();
        }
    }
    private static void quickSort(int nums[],int left,int right){
        if(left<right){
            int mid=position(nums,left,right);
            quickSort(nums,left,mid-1);
            quickSort(nums,mid+1,right);
        }
    }
    private static int position(int nums[],int left,int right){
        int i=left;
        int j=right;
        int midNum=nums[left];
        while (i<j){
            while (i<j&&nums[j]>midNum){
                j--;
            }
            while (i<j&&nums[i]<=midNum){
                i++;
            }
            if(i<j){
               swap(nums,i++,j--);
            }
        }
        while (nums[i]>midNum){
            i--;
        }
        swap(nums,i,left);
        return i;
    }
    public static void swap(int nums[],int i,int j){
        int temp=nums[i];
        nums[i]=nums[j];
        nums[j]=temp;
    }
}